import service from '@/utils/request'

/*
 * @Author: zhouhx
 * @Description: 详情
 * @Date: 2022/10/14 15:17
 */
export const templateApi = (id: number) => {
  return service.get('/gen/template/' + id)
}

/*
 * @Author: zhouhx
 * @Description: 修改/新增
 * @Date: 2022/10/14 15:17
 */
export const templateSubmitApi = (dataForm: any) => {
  if (dataForm.id) {
    return service.put('/gen/template', dataForm)
  } else {
    return service.post('/gen/template', dataForm)
  }
}

/*
 * @Author: zhouhx
 * @Description: 分页
 * @Date: 2022/10/14 15:17
 */
export const templatePageApi = () => {
  return service.get('/gen/template/page')
}

/*
 * @Author: zhouhx
 * @Description: 列表查询
 * @Date: 2022/10/17 9:15
 */
export const templateListApi = (params:any) => {
  return service.get('/gen/template/list',{params:params})
}

// 测试模板内容
export const useTestGeneratorApi = (dataForm: any) => {
  return service.post('/gen/template/test', dataForm)
}
// 复制模板
export const useCopyGeneratorApi = (versionId:any,templateIds: any) => {
  return service.post('/gen/template/copyTemplate/'+versionId,templateIds)
}
